package task.manager;

//import static org.junit.Assert;
import junit.framework.Assert;
import junit.framework.TestCase;

/**
 * @author Harrison
 *
 */
public class UserListTest extends TestCase {
	
	UserList useList;
	String testUser;
	String testPass;
	String testUser2;
	String testPass2;
	
	public void setUp(){
		useList = new UserList();
		testUser = "testUser";
		testPass = "testPass";
		testUser2 = "testUser2";
		testPass2 = "testPass2";	
	}
	/**
	 * Test method for {@link task.manager.UserList#registerNewUser(String, String)}.
	 */
	public void testRegisterNewUser(){
		Assert.assertTrue("UserList is not empty after initilization",useList.getUserList().size()==0);
		useList.registerNewUser(testUser, testPass);
		Assert.assertTrue("New username was not added to empty UserList",useList.getUserList().containsKey(testUser));
		Assert.assertTrue("New user password was not added empty UserList",useList.getUserList().containsValue(testPass));
		useList.registerNewUser(testUser2, testPass2);
		Assert.assertTrue("New username was not added to filled UserList",useList.getUserList().containsKey(testUser2));
		Assert.assertTrue("New user password was not added filled UserList",useList.getUserList().containsValue(testPass2));
	}
	/**
	 * Test method for {@link task.manager.UserList#isValid(String, String)}.
	 */
	public void testIsValid(){
		Assert.assertTrue("UserList is not empty after initilization",useList.getUserList().size()==0);
		useList.registerNewUser(testUser, testPass);
		Assert.assertTrue("Attempt to match username to correct password did not return true",useList.isValid(testUser, useList.getUserList().get(testUser)));
	}

}
